package bert;

public final class AABB {

	public AABB(int left, int top, int right, int bottom) {
		Left = left;
		Top = top;
		Right = right;
		Bottom = bottom;
	}
	
	public final int Left;
	public final int Top;
	public final int Right;
	public final int Bottom;
	
	public boolean intersects(AABB other) {
		return !(this.Right < other.Left ||
				 this.Left > other.Right || 
			     this.Bottom < other.Top || 
			     this.Top > other.Bottom);
	}
	
	public AABB expanded(int size) 
	{
		return new AABB(this.Left - size,
				        this.Top - size, 
				        this.Right + size, 
				        this.Bottom + size);
	}
}
